package com.icarsaas.saas;

import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.autoconfigure.jdbc.DataSourceAutoConfiguration;
import org.springframework.boot.builder.SpringApplicationBuilder;
import org.springframework.boot.web.servlet.support.SpringBootServletInitializer;
import org.springframework.cache.annotation.EnableCaching;
import org.springframework.data.jpa.repository.config.EnableJpaAuditing;
import org.springframework.scheduling.annotation.EnableAsync;

/**
 * <P>用途:SpringBoot启动类<p>
 * <P>描述:指定项目为springboot，此类当作程序入口，自动装配 web依赖的环境<p>
 * 
 * @author chlingm
 *
 */
//@SpringBootApplication(scanBasePackages = {"com.icarsaas.saas"},exclude = { DataSourceAutoConfiguration.class })
@SpringBootApplication(exclude = { DataSourceAutoConfiguration.class })
@EnableAsync @EnableCaching
@EnableJpaAuditing // 使用jpa自动赋值,结合@EntityListeners使用
public class IcarsaasApplication extends SpringBootServletInitializer {

    public static void main(String[] args) {
        SpringApplication.run(IcarsaasApplication.class, args);
    }
    
   //辅助springboot maven 打包启动
    @Override
    protected SpringApplicationBuilder configure(SpringApplicationBuilder builder) {
        return builder.sources(this.getClass());
    }
    
    /**
     * 自定义启动属性
	 * 设置服务端口
	@SuppressWarnings("rawtypes") @Bean
	public WebServerFactoryCustomizer webServerFactoryCustomizer(){
		return new WebServerFactoryCustomizer<ConfigurableServletWebServerFactory>() {
		@Override
		 public void customize(ConfigurableServletWebServerFactory factory) {
		    factory.setPort(8896);
			factory.setContextPath("/saas");
		 }
	   };
    }
     */
	
}